<style>
	.button-table{
		margin-top:10px;
		margin-left:26px;
	}
</style>

<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default gradient">
			<div class="panel-heading">
				<h4>
					<span>Grid Pengaduan & Saran</span>
				</h4>
			</div>
			<div class="panel-body noPad clearfix">
				<table cellpadding="0" cellspacing="0" border="0" class="dynamicTable display table table-bordered" width="100%">
					<div class="button-table">
						<button type="submit" class="btn btn-info" onClick="tambah()">
							<span class="icon16 icomoon-icon-plus-circle white"></span>
							Tambah
						</button>
					</div>
					<thead>
						<tr>
							<th><center>Kode</center></th>
							<th>Edit</th>
							<th>Tindak Lanjut</th>
							<th>Nama</th>
							<th>No. Telepon</th>
							<th>Email</th>
							<th>Isi</th>
							<th>Media</th>
							<th>Tanggal</th>
							<th>Ijin</th>
							<th>No. UPTSA</th>
							<th>Status</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach($data_pengaduan_saran as $row){?>
							<tr class="odd gradeX">
								<td><center><?php echo $row['KD_PENGADUAN_SARAN']?></center></td>
								<td>
									<div class="controls center">
										<?php if($row['STATUS'] == 1){?>
											<a href="" onClick="edit_finish()" title="Edit Data" class="tip" disabled><span class="icon14 icomoon-icon-pencil"></span></a>
										<?php }elseif($row['STATUS'] == 2){?>
											<a href="javascript:edit(<?php echo $row["KD_PENGADUAN_SARAN"]; ?>)" title="Edit Data" class="tip"><span class="icon14 icomoon-icon-pencil"></span></a>
										<?php }?>
									</div>
								</td>
								<td>
									<div class="control center">
										<a href="javascript:tindak_lanjut(<?php echo $row["KD_PENGADUAN_SARAN"]; ?>)" title="Tindak Lanjuti Data" class="tip"><span class="icon14 cut-icon-popout-2"></span></a>
									</div>
								</td>
								<td><?php echo $row['NAMA'];?></td>
								<td><?php echo $row['NO_TELP'];?></td>
								<td><?php echo $row['EMAIL'];?></td>
								<td><?php echo $row['ISI'];?></td>
								<td><?php 
									if($row['MEDIA'] == 1){
										echo "LANGSUNG";
									}elseif($row['MEDIA'] == 2){
										echo "TELEPON";
									}elseif($row['MEDIA'] == 3){
										echo "EMAIL";
									}elseif($row['MEDIA'] == 4){
										echo "WEBSITE";
									}else{
										echo "-";
									}
								?></td>
								<td><?php echo $row['TANGGAL'];?></td>
								<td><?php if($row['KD_IJIN'] != NULL){echo $row['NAMA_IJIN'];}else{ echo "-";}?></td>
								<td><?php if($row['NO_UPTSA'] != NULL){echo $row['NO_UPTSA'];}else{ echo "-";}?></td>
								<td><?php 
									if($row['STATUS'] == 1){ 
										echo "<font color='green'>Selesai</font>";
									}elseif($row['STATUS'] == 2){
										echo "<font color='orange'>Masih Proses</font>";
									}else{ 
										echo "-";
									}
									?>
								</td>
							</tr>
						<?php }?>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</div>

<link href="<?php echo $this->config->item('plugin_path');?>tables/dataTables/jquery.dataTables.css" type="text/css" rel="stylesheet" />
<link href="<?php echo $this->config->item('plugin_path');?>tables/dataTables/TableTools.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/dataTables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/dataTables/TableTools.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/dataTables/ZeroClipboard.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/responsive-tables/responsive-tables.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('js_path');?>datatable.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>misc/nicescroll/jquery.nicescroll.min.js"></script>
<script>
function tambah(){
	document.location="<?php echo site_url("pengaduan_saran/front_form")?>";
}
function edit(id){
	document.location="<?php echo site_url("pengaduan_saran/front_form")?>/"+ id;
}
function edit_finish(){
	alert("Data sudah selesai difinalisasi, tidak dapat dirubah lagi !");
}
function tindak_lanjut(id){
	document.location="<?php echo site_url("pengaduan_saran/form_tindak_lanjut_pengaduan")?>/"+ id;
}
</script>